module.exports = {
    navBack: function() {
        var t = getCurrentPages();
        t.length < 2 && t[0].route !== __wxConfig.pages[0] ? wx.reLaunch({
            url: "/" + __wxConfig.pages[0]
        }) : wx.navigateBack({
            delta: 1
        });
    },
    getOptionsParams: function(t, e) {
        var a = null;
        if ((t = t.split("?"))[1]) for (var r = t[1].split("&"), i = 0; i < r.length; i++) {
            var n = r[i].split("=");
            if (n[0] === e) {
                a = n[1];
                break;
            }
        }
        return a;
    },
    getCodeOptionsParams: function() {
        var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", e = arguments[1], a = t.split("&"), r = null;
        if (a.length) for (var i = 0; i < a.length; i++) {
            var n = a[i].split("=");
            if (n[0] === e) {
                r = n[1];
                break;
            }
        }
        return r;
    },
    copyCanvas: function(t, e) {
        var a = t.ctx, r = t.scale, i = t.color, n = t.imgList, l = t.diySize, o = 1 * t.position, s = t.face, f = l[1 === s ? "front" : "back"][o].width, c = l[1 === s ? "front" : "back"][o].height;
        a.save(), a.clearRect(0, 0, f * r, c * r), "#FFF" !== i && "#FFFFFF" !== i && "WHITE" !== i || (a.setFillStyle(i), 
        a.fillRect(0, 0, f * r, c * r), a.save()), n.forEach(function(t) {
            a.save();
            var e = t.scale * r, i = t.width * e, n = t.height * e, l = t.x * r, o = t.y * r;
            if (a.translate(l + i / 2, o + n / 2), a.rotate(t.degree * Math.PI / 180), a.translate(-i / 2, -n / 2), 
            "text" === t.type) {
                a.setFillStyle(t.color), a.setTextAlign("center");
                var s = t.fontSize * e;
                a.font = (t.isBold ? "normal bold " : "") + "10px sans-serif", a.setFontSize(s), 
                a.setTextBaseline("middle"), a.fillText(t.path, i / 2, n / 2, i - 10 * r);
            } else a.drawImage(t.path, 0, 0, i, n);
            a.restore(), a.restore();
        }), a.draw(!1, function() {
            "function" == typeof e && e();
        });
    }
};